"use strict";
/**
 * Created by fifths on 17-8-14.
 */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var LocalStorageService = /** @class */ (function () {
    function LocalStorageService() {
    }
    // 设置当前所在的小程序
    LocalStorageService.prototype.setNowApplet = function (item) {
        delete item.config;
        delete item.pay_key;
        delete item.AppSecret;
        var data = JSON.stringify(item);
        localStorage.setItem('nowApplet', data);
    };
    // 获取当前所在的小程序
    LocalStorageService.prototype.getNowApplet = function () {
        var data = localStorage.getItem('nowApplet');
        return JSON.parse(data);
    };
    // 设置当前member登录用户信息
    LocalStorageService.prototype.setUserInfo = function (item) {
        var data = JSON.stringify(item);
        localStorage.setItem('userInfo', data);
    };
    // 获取当前member登录用户信息
    LocalStorageService.prototype.getUserInfo = function () {
        var data = localStorage.getItem('userInfo');
        return JSON.parse(data);
    };
    // 设置当前admin登录用户信息
    LocalStorageService.prototype.setAdminInfo = function (item) {
        var data = JSON.stringify(item);
        localStorage.setItem('adminInfo', data);
    };
    // 获取当前admin登录用户信息
    LocalStorageService.prototype.getAdminInfo = function () {
        var data = localStorage.getItem('adminInfo');
        return JSON.parse(data);
    };
    // 设置token
    LocalStorageService.prototype.setToken = function (item) {
        var data = JSON.stringify(item);
        localStorage.setItem('token', data);
    };
    // 获取token
    LocalStorageService.prototype.getToken = function () {
        var data = localStorage.getItem('token');
        return JSON.parse(data);
    };
    //设置当期前小程序管理员的授权状态
    LocalStorageService.prototype.setAppletToken = function (item) {
        var data = JSON.stringify(item);
        localStorage.setItem('appletToken', data);
    };
    // 清除当前小程序的管理员的授权状态
    LocalStorageService.prototype.clearAppletToken = function () {
        localStorage.removeItem('appletToken');
    };
    // 获取token
    LocalStorageService.prototype.getAppletToken = function () {
        var data = localStorage.getItem('appletToken');
        return JSON.parse(data);
    };
    // 清除所有信息
    LocalStorageService.prototype.clearAll = function () {
        localStorage.clear();
    };
    // 清除小程序信息
    LocalStorageService.prototype.clearNowAppleto = function () {
        localStorage.removeItem('nowApplet');
    };
    // 清除用户信息
    LocalStorageService.prototype.clearUserInfo = function () {
        localStorage.removeItem('userInfo');
    };
    // 清除token
    LocalStorageService.prototype.clearToken = function () {
        localStorage.removeItem('token');
    };
    LocalStorageService = __decorate([
        core_1.Injectable()
    ], LocalStorageService);
    return LocalStorageService;
}());
exports.LocalStorageService = LocalStorageService;
